package com.gitee.wsl.coroutines.api

import kotlin.time.ExperimentalTime
import kotlin.time.Instant

interface LockKey<Task,TASK_LOCK> {

    /**
     * Get permission to execute the task
     */
      @OptIn(ExperimentalTime::class)
      suspend fun acquireLockKey(task: Task, executionTime: Instant, concurrencyIndex: Int): TASK_LOCK?

    /**
     * Release permission to execute the task
     */
      suspend fun releaseLockKey(key: TASK_LOCK)
}